import Vue from 'vue';
import iView from 'iview';
import {router} from './router/index';
import store from './store';
import App from './app.vue';
import '@/locale';
import 'iview/dist/styles/iview.css';
import VueI18n from 'vue-i18n';
import util from './libs/util';
import {post,get,put,patch,postFormData} from './libs/http';
import custom_form from './views/my-components/form-designer/custom_form';
import cascaderMulti from 'cascader-multi';
import iviewArea from 'iview-area';

Vue.use(VueI18n);
Vue.use(iView);
Vue.use(custom_form);
Vue.use(cascaderMulti);
Vue.use(iviewArea);


new Vue({
    el: '#app',
    router: router,
    store: store,
    render: h => h(App),
    data: {
        currentPageName: ''
    },
    mounted () {
        this.currentPageName = this.$route.name;
        // 调用方法，动态生成路由
        util.initRouter(this);
        // 显示打开的页面的列表
        this.$store.commit('setOpenedList');
        this.$store.commit('initCachepage');
        // 权限菜单过滤相关
        this.$store.commit('updateMenulist');
    },
    created () {
    }
});
Vue.prototype.$post=post;
Vue.prototype.$get=get;
Vue.prototype.$put=put;
Vue.prototype.$delete=patch;
Vue.prototype.$postFormData=postFormData;
Vue.prototype.util=util;